﻿#ifndef HTTPPOST_H
#define HTTPPOST_H

#include <functional>

class QByteArray;
class QNetworkReply;
class QObject;
class QString;
class QUrl;

void post(const QUrl& url, const QByteArray& data, QObject* context, std::function<void(QNetworkReply*)> callback, int timeout = 30*1000);
void postJson(const QUrl& url, const QByteArray& data, QObject* receiver, const char *member, int timeout = 30*1000);

QByteArray getFileName(const QByteArray& data, const QByteArray &suffix);
void upload(const QByteArray& data, const QByteArray &fileName, QObject* context, std::function<void(const QString *)> callback, int timeout = 30*1000);

#endif // HTTPPOST_H
